/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package manager;

import Entity.Employee;
import Entity.User;
import database.AuthorManagerDB;
import database.Connection;
import database.DepartmentManagerDB;
import database.EmployeeManagerDB;
import database.SingleManagerDB;
import database.UserManagerDB;

/**
 *
 * @author BinhNV_A04911
 */
public class Manager {
 private AuthorManager authorManager;
 private AuthorManagerDB authorManagerDB;
 private DepartmentManager departManager;
 private DepartmentManagerDB departManagerDB;
 private EmployeeManager employeeManager;
 private EmployeeManagerDB employeeManagerDB;
 private Employee employee;
 private SingleManager singleManager;
 private SingleManagerDB singleManagerDB;
 private UserManager userManager;
 private UserManagerDB userManagerDB;
 private Connection conn;


    public Manager(){
    this.conn=new Connection();
    this.employeeManager = new EmployeeManager();
    this.employeeManagerDB = new EmployeeManagerDB(conn.getConn());
    this.employeeManagerDB.loadData(employee);
   }
    public void  setUse(Employee employee){
        this.employee = employee;
        this.initManager();
    }
    private void initManager(){
        this.userManager= new UserManager();
        this.authorManager = new AuthorManager();
        this.departManager = new DepartmentManager();
        this.employeeManager = new EmployeeManager();
        this.singleManager = new SingleManager();
   }
    private void loadDataToManager(){
        this.userManagerDB = new UserManagerDB(conn.getConn());
        this.authorManagerDB = new AuthorManagerDB(conn.getConn());
        this.departManagerDB = new DepartmentManagerDB(conn.getConn());
        this.employeeManagerDB = new EmployeeManagerDB(conn.getConn());
        this.singleManagerDB = new SingleManagerDB(conn.getConn());

        this.userManagerDB.loadData(this.userManager);
        this.authorManagerDB.loadData(this.authorManager);
        this.departManagerDB.loadData(this.departManager);
        this.employeeManagerDB.loadData(this.employeeManager);
        this.singleManagerDB.loadData(this.singleManager);
   }
    public AuthorManager getAuthorManager(){
        return authorManager;
    }
    public DepartmentManager getDepartmentManager(){
        return departManager;
    }
    public EmployeeManager getEmployeeManager(){
        return employeeManager;
    }
    public SingleManager getSingleManager(){
        return singleManager;
    }
    public UserManager getUserManager(){
        return userManager;
    }

   public AuthorManagerDB getAuthorManagerDB(){
        return authorManagerDB;
    }
    public DepartmentManagerDB getDepartmentManagerDB(){
        return departManagerDB;
    }
    public EmployeeManagerDB getEmployeeManagerDB(){
        return employeeManagerDB;
    }
    public SingleManagerDB getSingleManagerDB(){
        return singleManagerDB;
    }
    public UserManagerDB getUserManagerDB(){
        return userManagerDB;
    }


}
